package edu.wpi.first.wpilibj.templates.commands;

/**
 *
 * @author Super NURDs
 */

public class DoShoot extends CommandBase {
    private boolean forward;
    private double speed;
    
    public static final double SPEED_MAGNITUDE = 0.7;
    
    public DoShoot() {
         // Use requires() here to declare subsystem dependencies
        // eg. requires(chassis);
        requires(myHopper);
    }

    // Called just before this Command runs the first time
    protected void initialize() {
        if (myHopper.getStartSwitchState() == true) {
            forward = true;
            speed = SPEED_MAGNITUDE;
        }
        else {
            forward = false;
            speed = -SPEED_MAGNITUDE;
        }
        myHopper.setSpeed(speed);
    }

    // Called repeatedly when this Command is scheduled to run
    protected void execute() {
    }
                
    // Make this return true when this Command no longer needs to run execute()
    protected boolean isFinished() {
        if(forward) {
            if(myHopper.getStopSwitchState() == true) {
                return true;
            }
        }
        else {
            if(myHopper.getStartSwitchState() == true) {
                return true;
            }
        }
        return false;
    }

    // Called once after isFinished returns true
    protected void end() {
        myHopper.setSpeed(0.0);
    }

    // Called when another command which requires one or more of the same
    // subsystems is scheduled to run
    protected void interrupted() {
        end();
    }
}